package 蓝桥.十四届;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author ZhuYi
 * @create 2025/2/20 21:25
 */
public class C数组分割 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());
        int mod = 1000000007;
        while (t-- != 0) {
            int n = Integer.parseInt(br.readLine());
            int[] arr = new int[1010];
            int[][] dp = new int[1010][2];
            String[] s = br.readLine().split(" ");
            int sum = 0;
            for (int i = 1; i <= n; i++) {
                arr[i] = Integer.parseInt(s[i - 1]);
                sum += arr[i];
            }

            if (sum % 2 != 0) {
                System.out.println(0);
                continue;
            }
            for (int j = 1; j <= n; j++) {
                dp[j][0] = dp[j][1] = 0;
            }
            dp[0][0] = 1;//为空集时有一种方案
            for (int k = 1; k <= n; k++) {
                if (arr[k] % 2 == 1) {//奇数时，如何满足方案 的选择
                    dp[k][0] = (dp[k - 1][0] + dp[k - 1][1]) % mod; //为偶数的方案 不选 选
                    dp[k][1] = (dp[k - 1][1] + dp[k - 1][0]) % mod; //为奇数的方案 不选 选
                } else {//偶数
                    dp[k][0] = (dp[k - 1][0] + dp[k - 1][0]) % mod; //不选 选
                    dp[k][1] = (dp[k - 1][1] + dp[k - 1][1]) % mod; //不选 选
                }
            }
            System.out.println(dp[n][0]);
        }
    }
}
